<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>判断是否是闰年</title>
</head>
<body>
<script>
    function panduan(year) {
        if ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0) {
            return true;
        } else {
            return false;
        }
    }

    var Shuru = prompt("请输入一个年份：");

    if (Shuru === null || Shuru === "" || isNaN(Shuru)) {
        alert("请输入有效的年份！");
    } else {
        var Shuchu = parseInt(Shuru);

        var result = panduan(Shuchu);

        if (result) {
            alert(Shuchu + "年是闰年。");
        } else {
            alert(Shuchu + "年是平年。");
        }
    }
</script>
</body>
</html>